package com.esteel.settlement.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.esteel.settlement.dao.SettDictonaryRepository;
import com.esteel.settlement.entity.TbSettDictionary;
import com.esteel.settlement.service.SettDictionaryService;

@Service
public class SettDictionaryServiceImpl implements SettDictionaryService {

	@Autowired
	private SettDictonaryRepository settDictonaryRepository;
	
	@Override
	public List<TbSettDictionary> findByDictType(String dictType) {
		return settDictonaryRepository.findByDictType(dictType);
	}
	
	@Override
	public Map<String, String> mapByDictType(String dictType) {
		List<TbSettDictionary> list = this.findByDictType(dictType);
		Map<String,String> map = new HashMap<String,String>();
		for (TbSettDictionary dict : list){
			map.put(dict.getDictKey(), dict.getDictDesc());
		}
		return map;
	}


}
